{{!
  Copyright IBM Corp. 2016, 2025
  SPDX-License-Identifier: BUSL-1.1
}}

<div ...attributes>
  {{#if @label}}
    <div class="label-row">
      <label for={{@name}}>
        {{@label}}
      </label>
      {{#if @helpText}}
        <Hds::TooltipButton @text={{@helpText}} aria-label="More information">
          <Hds::Icon @name="info" />
        </Hds::TooltipButton>
      {{/if}}
    </div>
  {{/if}}
  {{#if this.authMethods.isRunning}}
    <div>
      <span class="loader is-inline-block"></span>
    </div>
  {{else if this.authMethods.last.value}}
    <div class="control is-expanded">
      <div class="select is-fullwidth">
        <select
          aria-label={{or @label "Select a mount accessor"}}
          name={{@name}}
          id={{@name}}
          {{on "change" this.change}}
          data-test-mount-accessor-select
        >
          {{#if this.noDefault}}
            <option value="">Select one</option>
          {{/if}}
          {{#each this.authMethods.last.value as |method|}}
            {{! token type does not need to be authorized via MFA }}
            {{#if this.filterToken}}
              {{#if (not-eq method.id "token")}}
                <option selected={{eq @value method.accessor}} value={{method.accessor}}>
                  {{method.path}}
                  ({{if @showAccessor method.accessor method.type}})
                </option>
              {{/if}}
            {{else}}
              <option selected={{eq @value method.accessor}} value={{method.accessor}}>
                {{method.path}}
                ({{if @showAccessor method.accessor method.type}})
              </option>
            {{/if}}
          {{/each}}
        </select>
      </div>
    </div>
  {{else}}
    <input
      name={{@name}}
      id={{@name}}
      class="input"
      value={{@value}}
      placeholder="Mount accessor"
      {{on "change" this.change}}
      data-test-mount-accessor-default
    />
  {{/if}}
</div>